<!DOCTYPE html>
<html>
 <head> 
  <title>laravel5.1安装--闫海的个人博客-芒果小叨</title> 
  <!-- meta tags start --> 
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
  <meta name="Keywords" content="个人博客,闫海个人博客,laravel5.1,laravel安装,laravel5" /> 
  <meta name="Description" content="laravel5.1终于发布了，作为 Laravel 历史上第一个提供 LTS支持的版本，先入手体验一下。" /> 
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" /> 
  <!-- meta tags end -->
  <!-- favorite icon starts -->
  <link rel="shortcut icon" href="/Public/Index/mobile/images/common/favicon.ico" type="image/x-icon" />
  <!-- favorite icon ends -->
  <!-- CSS files start -->
  <link href="/Public/Index/mobile/css/framework.css" rel="stylesheet" type="text/css" media="all" />
  <link href="/Public/Index/mobile/css/colorbox.css" rel="stylesheet" type="text/css" media="all" />
  <link href="/Public/Index/mobile/css/responsive.css" rel="stylesheet" type="text/css" media="screen" />
  <link href="/Public/Index/mobile/css/hidpi.css" rel="stylesheet" type="text/css" media="screen" />
  <link href="/Public/Index/mobile/css/skin.css" rel="stylesheet" type="text/css" media="all" />
  <link href="/Public/Index/mobile/css/custom.css" rel="stylesheet" type="text/css" media="all" />
  <link href="/Public/Index/mobile/css/elements.css" rel="stylesheet" type="text/css" media="all" />
  <link href="/Public/Index/mobile/css/style.css" rel="stylesheet" type="text/css" media="all" />
  
  <!-- CSS files end -->
  <!-- JavaScript files start --> 
  <script type="text/javascript" src="/Public/Index/mobile/grayscale.js"></script>
  <script type="text/javascript" src="/Public/Index/mobile/js/jquery.min.js"></script>
  <script type="text/javascript" src="/Public/Index/mobile/js/effects.jquery-ui.min.js"></script>
  <script type="text/javascript" src="/Public/Index/mobile/js/jquery.nivo-slider.min.js"></script>
  <script type="text/javascript" src="/Public/Index/mobile/js/custom.js"></script>
  <script type="text/javascript" src="/Public/Index/mobile/js/jquery.colorbox.min.js"></script>
  
  <!-- JavaScript files end -->
 </head>
 <body>
  <!-- website wrapper starts -->
  <div class="websiteWrapper"> 
   <!-- main menu wrapper starts --> 
   <div class="mainMenuOuterWrapper"> 
    <a href="#" class="mainMenuCloseButton"></a> 
    <ul class="mainMenuWrapper"> 
     <li class="currentPage"><a href='/mobile.php/index.html' title='首页'>首页</a></li>
      <li><a href='/mobile.php/list/2.html' title='关于我'>关于我<span> </span></a></li><li><a href='/mobile.php/list/3.html' title='时光轴'>时光轴<span> </span></a></li><li><a href='/mobile.php/list/1.html' title='品味人生'>品味人生<span> </span></a></li><li><a href='/mobile.php/list/5.html' title='技术分享'>技术分享<span> </span></a></li>     <li><a href='/mobile.php/index/article/message.html'  title='给我留言'>给我留言</a></li>
    </ul> 
   </div> 
   <!-- main menu wrapper ends --> 

<script type="text/javascript">
  var url = '/mobile.php/article';
  $(function(){
    var id = '46';
    $.post(url+'/addClick',{'id':id},function(data){
        $("#pclick").html('点击数：' + data);
    });
  })
</script>
   <!-- header wrapper starts --> 
   <div class="headerOuterWrapper pageHeaderWrapper"> 
    <div class="headerWrapper"> 
     <a class="mainLogo" href="/mobile.php/index.html"><img src="/Public/Index/mobile/images/mainLogo.png" alt="" /></a> 
     <a href="#" class="mainMenuButton"></a>
    </div>
    <!-- page title starts --> 
    <h5 class="pageTitle">当前位置：
	<a href="/mobile.php/index.html">首页</a>&nbsp;&gt;&nbsp;
	<a href="/mobile.php/list/5.html">技术分享</a>
	&nbsp;&gt;&nbsp;<a href="/mobile.php/list/17.html">Laravel教程</a>
	</h5>    <!-- page title ends --> 
   </div>
   <!-- header wrapper ends --> 
   <!-- page wrapper starts --> 
   <div class="pageWrapper singlePostPageWrapper"> 
    <!-- post content wrapper starts --> 
    <div class="singlePostContentWrapper">
    <h3 class="pageTitle" style="background:#F0F0F0;color:#333;text-align:center;">laravel5.1安装</h3> 
     <div class="pageSpacer"></div> 
     <div class="pageSpacer"></div> 
     <div style="word-break: break-all;" class="phoneContent"><p><span style="color: rgb(0, 0, 0);">Laravel 于6月9日正式发布了 5.1 最新 LTS 版本。这是 Laravel 历史上第一个提供 LTS（长期支持 － long-time support） 支持的版本。</span></p><p><span style="color: rgb(0, 0, 0);">首先使用Laravel5.1 系统上有一些限制：</span></p><p><span style="color: rgb(192, 0, 0);">PHP &gt;= 5.5.9</span> &nbsp; &nbsp;<span style="color: rgb(192, 0, 0);">OpenSSL PHP 扩展</span> &nbsp; &nbsp;<span style="color: rgb(192, 0, 0);">Mbstring PHP 扩展</span> &nbsp; &nbsp;<span style="color: rgb(192, 0, 0);">Tokenizer PHP 扩展</span></p><p><span style="color: rgb(0, 0, 0);">安装laravel依赖composer，composer下载方法之前已经说过，这里不再重复linux用户可以参考之前的文章</span><a style="text-decoration: underline; color: rgb(0, 176, 240);" title="初探Laravel5" target="_blank" href="http://www.yanhai0531.com/index/article/45.html"><span style="color: rgb(0, 176, 240);">初探Laravel5</span></a><span style="color: rgb(0, 0, 0);">，也可以</span><a style="text-decoration: underline; color: rgb(0, 176, 240);" title="参考这里" target="_blank" href="https://getcomposer.org/download/"><span style="color: rgb(0, 176, 240);">参考这里</span></a><span style="color: rgb(0, 0, 0);">。window用户需要下载&nbsp;</span><a style="text-decoration: underline; color: rgb(0, 176, 240);" title="https://getcomposer.org/Composer-Setup.exe" target="_blank" href="https://getcomposer.org/Composer-Setup.exe"><span style="color: rgb(0, 176, 240);">https://getcomposer.org/Composer-Setup.exe</span></a><span style="color: rgb(0, 0, 0);">
 来进行管理。</span></p><p><span style="color: rgb(255, 0, 0);">这里在安装composer的时候需要注意一些问题：</span></p><p><span style="color: rgb(255, 0, 0);">1.如果安装不成功，一般会提示要开启php扩展openssl，如果你用的wamp集成环境，切记在wamp面板中修改
php.ini是没用的，需要修改wamp/bin/php/你的php版本/php.ini，去掉extension=php_openssl.dll
前面的分号，并重启server。</span></p><p><span style="color: rgb(255, 0, 0);">2.如果在windows环境下提示 error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE... 一般是没有安装CA证书导致的，<a style="text-decoration: underline; color: rgb(0, 176, 240);" target="_blank" href="http://curl.haxx.se/docs/caextract.html"><span style="color: rgb(0, 176, 240);">下载证书</span></a>，然后修改php.ini文件，在后面加上openssl.cafile= D:/wamp/php/verify/cacert.pem(这里填写你的路径)</span></p><p><span style="color: rgb(255, 0, 0);">3.如果安装composer总是超时，那没办法了，可能是你的网络被墙的太厉害，百度搜个一小时的vpn，挂上立马下载好。vpn不需要买，因为我们之后的composer操作都是请求日本的代理，速度也还可以<br/></span></p><p><span style="color: rgb(0, 0, 0);">以下内容以windows为例。</span></p><p><span style="color: rgb(0, 0, 0);">接下来安装laravel5.1，安装方法有很多，<a style="color: rgb(0, 176, 240); text-decoration: underline;" title="官方文档" target="_blank" href="http://laravel.com/docs/5.1#installation"><span style="color: rgb(0, 176, 240);">官方文档</span></a>中有介绍，但是那些方法你懂的，要不用vpn啥的速度真不敢恭维。。。我一般喜欢这样安装，下载官方的<a style="color: rgb(0, 176, 240); text-decoration: underline;" textvalue="laravel5.1" target="_blank" href="https://github.com/laravel/laravel/archive/v5.1.0.zip"><span style="color: rgb(0, 176, 240);">laravel5.1</span></a>（下载其他版本可以<a style="color: rgb(0, 176, 240); text-decoration: underline;" target="_blank" href="https://github.com/laravel/laravel/"><span style="color: rgb(0, 176, 240);">点这里</span></a>，点branch：master然后在tags中选择版本，然后download）。下载后解压到你想要存放的目录，比如我用的wamp，我就直接把laravel-master中的内容解压到E：wamp/www/下。</span></p><p><span style="color: rgb(0, 0, 0);">然后开启cmd。</span></p><pre class="brush:bash;toolbar:false">e:
cd&nbsp;wamp/www</pre><p><span style="color: rgb(0, 0, 0);">在这里我们需要用composer安装框架依赖包，安装之前我们需要在项目根目录下的composer.json中&quot;prefer-stable&quot;: true后面加一段代码：</span></p><pre class="brush:bash;toolbar:false">&quot;repositories&quot;:&nbsp;[&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&quot;packagist&quot;:&nbsp;false&nbsp;},&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;type&quot;:&nbsp;&quot;composer&quot;,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&quot;url&quot;:&nbsp;&quot;http://composer-proxy.jp/proxy/packagist&quot;&nbsp;&nbsp;&nbsp;&nbsp;}]</pre><p><span style="color: rgb(0, 0, 0);">由于中国镜像极不稳定，所以使用这个日本的镜像来提高使用composer下载的速度。回到cmd：</span></p><pre class="brush:bash;toolbar:false">composer&nbsp;install</pre><p><span style="color: rgb(0, 0, 0);">也就一两分钟，框架依赖包就都安装好了。</span></p><p><span style="color: rgb(0, 0, 0);">然后把根目录的</span><code><span style="color: rgb(0, 0, 0);">.enb.example</span></code><span style="color: rgb(0, 0, 0);">重命名.env，返回cmd中：</span></p><pre class="brush:bash;toolbar:false">php&nbsp;artisan&nbsp;key:generate</pre><p><span style="color: rgb(0, 0, 0);">随机生成一个项目的加密key，这个key必须设置，否则session 和其他需要加密的数据就会不安全。</span></p><p><span style="color: rgb(0, 0, 0);">默认情况下访问浏览器访问localhost/public（你也可以自行配置apache修改这个路径），开始探索laravel5.1的世界吧。</span></p><p><span style="color: rgb(0, 0, 0);">默认欢迎信息居然还有老子的话。。。</span></p><p><img style="width: 600px; height: 400px; float: left;" alt="5578ed8022de6.jpg" src="http://www.yanhai0531.com/Uploads/ueditor/image/20150611/5578ed8022de6.jpg" title="5578ed8022de6.jpg" height="400" border="0" vspace="0" width="600"/></p></div>
     <div class="textBreak"></div> 
    </div> 
    <!-- post content wrapper ends --> 
    <!-- post info starts --> 
    <div class="singlePostInfoWrapper">
     <span class="singleIconWrapper singleIconText iconCalendarDark postInfo postDate">2015-06-11</span>
     <a class="singleIconWrapper singleIconText iconEditDark postInfo postAuthor postInfoNoMargin">小叨</a>&nbsp;&nbsp;
     <span class="singleIconWrapper singleIconText iconArrowRightDark" id="pclick">点击数：331</span>
    </div> 
    <!-- post info ends --> 
    <!-- post links wrapper starts --> 
    <div class="singlePostContentWrapper"> 
     <p>上一篇：<a href="/mobile.php/article/45.html">初探Laravel5</a></p>
     <p>下一篇：<a href="/mobile.php/article/47.html">Laravel5.1配置</a></p>
    </div> 
    <!-- post links wrapper ends --> 
    <!-- comments section wrapper starts --> 
    <div class="commentsSectionWrapper"> 
     <h4 class="commentsTitle">相关阅读：</h4> 
     <!-- comments wrapper starts --> 
     <!-- accordion item wrapper starts --> 
        <div class="accordionContent"> 
         <p><a href="/mobile.php/article/48.html" title="【Laravel5教程】mac+apache+mysql配置多站点(一)">【Laravel5教程】mac+apache+mysql配置多站点(一)</a></p><p><a href="/mobile.php/article/47.html" title="Laravel5.1配置">Laravel5.1配置</a></p><p><a href="/mobile.php/article/46.html" title="laravel5.1安装">laravel5.1安装</a></p><p><a href="/mobile.php/article/45.html" title="初探Laravel5">初探Laravel5</a></p>        </div> 
     <!-- accordion item wrapper ends -->
     <!-- coments wrapper ends --> 
    </div> 
    <!-- comments section wrapper ends --> 
   </div> 
   <!-- page wrapper ends --> 
   <!-- footer wrapper starts --> 
   <div class="footerWrapper"> 
    <!-- copyright wrapper starts --> 
    <div class="copyrightWrapper"> 
     <!-- copyright starts --> 
     <span class="copyright"><a href="http://www.miitbeian.gov.cn/">鲁ICP备15004472号-1</a></span> 
     <!-- copyright ends --> 
     <!-- back to top button starts --> 
     <a href="" class="backToTopButton"></a> 
     <!-- back to top button ends --> 
    </div> 
    <!-- copyright wrapper ends --> 
   </div> 
   <!-- footer wrapper ends --> 
  </div>
  <!-- website wrapper ends -->
 </body>
</html>